

<!DOCTYPE html>
<html>
	<head>
		<title>云盘多多</title>
		<meta charset="utf-8">
		<script src="js/axios.js"></script>
		<script>
			function sendRequest() {
				let inputStr = document.getElementById("inputText").value;
				let token = document.getElementById("token").value;
				let type = document.getElementById("type").value;
				const lines = inputStr.split('\n'); // 按行分割文本
				let index = 0
				let headers = {
					// 'Sec-Ch-Ua-Platform': 'Windows',
					'Content-Type': 'multipart/form-data',
					// 'Origin': 'https://quanxingdaohang.com',
					// 'Referer': `https://quanxingdaohang.com/go/${type}`,
					'X-Token': token
				}

				console.log('inputStr', inputStr, token, type, lines.length)

				function requestRoll() {
					console.log('requestRoll', index)
					if (index < lines.length) {
						const [name, url] = lines[index].split(',')
						const data = {
							'recommend': 1,
							'type': parseInt(type),
							'name': name.trim(),
							'url': url.trim()
						}
						axios.post('https://api.quanxingdaohang.com/v1/localSite/add', data, {
							headers
						}).then(res => {
							console.log(res)
						}).catch(err => {
							console.error(lines[index])
							console.log(err)
						}).finally(() => {
							setTimeout(() => {
								index++
								requestRoll()
							}, 200)
						})
					}
				}
				requestRoll()
			}
		</script>
	</head>
	<body>
		<textarea id="type" cols="50" style="min-height: 50px;" placeholder="type"></textarea>
		<textarea id="token" cols="50" style="min-height: 50px;" placeholder="token"></textarea>
		<br>
		<textarea id="inputText" cols="100" style="min-height: 150px;"></textarea>
		<br>
		<button onclick="sendRequest()">发送</button>
	</body>
</html>